#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int n;
int a[N], f[N];

int main() {
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> a[i];
		f[i] = 1;
		for (int j = i - 1; j > 0; --j) {
			if (a[i] > a[j]) {
				f[i] = max(f[i], f[j] + 1);
			}
		}
	}
	int res = 0;
	for (int i = 1; i <= n; ++i) {
		res = max(res, f[i]);
	}
	cout << res << endl;
	return 0;
}